package com.huowenjie.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import org.apache.http.protocol.RequestContent;

import javax.servlet.http.HttpServletRequest;

public class TestFilter extends ZuulFilter {
    @Override
    public String filterType() {
        //类型  4种  pre post error route
        return "pre";
    }

    @Override
    public int filterOrder() {
        //指定等级 数字越小优先级越高
        return 0;
    }

    @Override
    public boolean shouldFilter() {
        //filter是否可用
        return false;
    }

    @Override
    public Object run() throws ZuulException {

        //获取当前上下文
        RequestContext currentContext = RequestContext.getCurrentContext();
        //获取request
        HttpServletRequest request = currentContext.getRequest();
        //获取请求路径
        String requestURI = request.getRequestURI();



        return null;
    }
}
